/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ylystudio.pms.ejb.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "knowledge_title")
@NamedQueries({
    @NamedQuery(name = "KnowledgeTitle.findAll", query = "SELECT k FROM KnowledgeTitle k"),
    @NamedQuery(name = "KnowledgeTitle.findByKtId", query = "SELECT k FROM KnowledgeTitle k WHERE k.ktId = :ktId"),
    @NamedQuery(name = "KnowledgeTitle.findByKtName", query = "SELECT k FROM KnowledgeTitle k WHERE k.ktName = :ktName"),
    @NamedQuery(name = "KnowledgeTitle.findByKtDescrip", query = "SELECT k FROM KnowledgeTitle k WHERE k.ktDescrip = :ktDescrip")})
public class KnowledgeTitle implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "kt_id")
    private Integer ktId;
    @Basic(optional = false)
    @Column(name = "kt_name")
    private String ktName;
    @Column(name = "kt_descrip")
    private String ktDescrip;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "knowledgeTitle", fetch = FetchType.LAZY)
    private List<KnowledgeTitleItem> knowledgeTitleItemList;

    public KnowledgeTitle() {
    }

    public KnowledgeTitle(Integer ktId) {
        this.ktId = ktId;
    }

    public KnowledgeTitle(Integer ktId, String ktName) {
        this.ktId = ktId;
        this.ktName = ktName;
    }

    public Integer getKtId() {
        return ktId;
    }

    public void setKtId(Integer ktId) {
        this.ktId = ktId;
    }

    public String getKtName() {
        return ktName;
    }

    public void setKtName(String ktName) {
        this.ktName = ktName;
    }

    public String getKtDescrip() {
        return ktDescrip;
    }

    public void setKtDescrip(String ktDescrip) {
        this.ktDescrip = ktDescrip;
    }

    public List<KnowledgeTitleItem> getKnowledgeTitleItemList() {
        return knowledgeTitleItemList;
    }

    public void setKnowledgeTitleItemList(List<KnowledgeTitleItem> knowledgeTitleItemList) {
        this.knowledgeTitleItemList = knowledgeTitleItemList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ktId != null ? ktId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof KnowledgeTitle)) {
            return false;
        }
        KnowledgeTitle other = (KnowledgeTitle) object;
        if ((this.ktId == null && other.ktId != null) || (this.ktId != null && !this.ktId.equals(other.ktId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ylystudio.pms.ejb.entity.KnowledgeTitle[ktId=" + ktId + "]";
    }

}
